package com.ht.medicaltreatment.adapter

import android.widget.TextView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.ht.medicaltreatment.R
import com.ht.medicaltreatment.bean.Page

class AnimalAdaptger:BaseQuickAdapter<Page,BaseViewHolder>(R.layout.item_animal_layout) {
    init {
        addChildClickViewIds(R.id.btnReplaceRFID)
    }
    override fun convert(holder: BaseViewHolder, item: Page) {
        val tvSex = holder.getView<TextView>(R.id.tvSex)
        holder.setText(R.id.tvCode,"${item.patientCode?:""}")
        holder.setText(R.id.tvName,item.patientName)
        holder.setText(R.id.tvIdCode,item.patientIdCard)
        holder.setText(R.id.tvLocation,"病房：${item.ward.name}")
        tvSex.setText(item.patientSex)
        if(item.patientSex == "男"){
            tvSex.setBackgroundResource(R.drawable.shape_sample_item_state_blue)
        }else{
            tvSex.setBackgroundResource(R.drawable.shape_scan_item_red_bg)
        }
    }

}
